package lesson05

class Student {
  var age:Int=20 //var 就好比 java里面有get  set
  val id:Int=1   //val 就好比这个属性有 get方法 没有set方法
  //只能在伴生对象内部进行访问
  private var name:String="tom"
  //访问权限控制得更严格。连伴生对象都不能直接访问。只能在自己内部进行使用
  private[this] var high=180

  def sayHello(): Unit ={
    println(high);
  }
}
object Student{
  def main(args: Array[String]): Unit = {
    val student: Student = new Student()
    student.name

  }
}

object Test{
  def main(args: Array[String]): Unit = {
    val student: Student = new Student()
    val age = student.age
    student.age=150
    val id = student.id
    //student.id=2 //相当于做了set的操作


    student

    println(student.age + "  "+ id)
  }
}
